#!/usr/bin/env bash
set -euxo pipefail

# Usage: bash scripts/install.sh [PYTHON_BIN] [VENV_DIR]
# Example: bash scripts/install.sh python3 .venv

PYTHON_BIN=${1:-python3}
VENV_DIR=${2:-.venv}

$PYTHON_BIN -m venv "$VENV_DIR"
source "$VENV_DIR/bin/activate"
python -m pip install --upgrade pip
pip install -r requirements.txt --no-cache-dir

# Optional: HuggingFace dataset helper
if ! command -v huggingface-cli >/dev/null 2>&1; then
  pip install huggingface_hub
fi

echo "\n[OK] Environment ready. Activate with: source $VENV_DIR/bin/activate"